<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>搜索页效果</title>
    <link rel="stylesheet" href="./reset.css">
    <style>
        .bigbox{
            width: 360px;
            height: 600px;
            margin: 30px auto;
            border: 1px solid gray;
        }
        input{
            width: 300px;
            height: 40px;
            background-color: rgb(231, 215, 215);
            border-radius: 30px;
            margin-top: 20px;
            color: rgb(145, 155, 156);
            margin-left: 10px;
            padding-left: 15px;
        }
        .wenzi{
            color: rgb(58, 114, 218);
        }
        .ago{
            margin-left: 10px;
            font-size: 16px;
            font-weight: 700;
            margin-top: 20px;
        }
        .item{
            margin-left: 10px;
            height: 30px;
            width: 180px;
            text-align: center;
            line-height: 30px;
            background-color: rgb(231, 215, 215);
            font-size: 12px;
            margin-top: 15px;        
        }
        .disc{
            margin-left: 10px;
            font-size: 16px;
            font-weight: 700;
            margin-top: 30px;
            margin-bottom: 10px;
        }
        .content{
            width: 340px;
        }
        .content span{
            background-color: rgb(231, 215, 215);
            height: 40px;
            width: 100%;
            font-size: 12px;
            margin-left: 10px;
            color: gray;
            margin-left: 10px;
        }
    </style>
</head>
<body>
    <div id="app">
       <div class="bigbox">
        <div class="input_box">
            <input type="text" placeholder="搜索商家、商品名称" v-model="inputText">
            <span class="wenzi" @click="search()">搜索</span>
        </div>
        <div class="historySearch">
            <div class="ago">历史搜索</div>
            <div class="item" v-for="(item,index) in historylist" :key="index">{{item}}</div>
        </div>
        <div class="find">
            <div class="disc">搜索发现</div>
            <div class="content">
                <span class="task" v-for="(item,index) in tasklist" :key="index">{{item}}</span>
            </div>
        </div>
        
       </div>
    </div>
</body>
</html>
<script src="./vue-2.5.21.js"></script>
<script>
    var v = new Vue({
        el:'#app',
        data:{
            inputText:'',
            tasklist:['麻辣烫','米线','披萨','蛋糕','汉堡','腊八粥','烤肉拌饭','炸鸡','味多美（揭阳路店）'],
            historylist:['天天鲜挪威三文鱼（立水桥站）']
        },
        methods:{
            search(){
                if(this.inputText){
                    this.historylist.push(this.inputText)
                    this.inputText = ''
                }      
            }
        }
    })
</script>